
* Prices 
reghdfe ln_p_sbjo   ///
  age_buy_month ln_p_inpf_sbjo ln_q_sbjo   if sample==1, ///
abs(gr_sjt gr_sb ) vce (cluster b_id) 
local saturated_model_r2 = e(r2) 
local N = e(N) 
local K = 3391+2332+3
capture drop include
gen byte include = e(sample)
reghdfe ln_p_sbjo    ///
 age_buy_month  ln_p_inpf_sbjo ln_q_sbjo  if include==1, ///
abs(gr_sjt   b_id ) vce (cluster b_id) 
local J =`K'-(3391+3-792)
local restricted_model_r2 = e(r2)
di (`e(r2)')/`saturated_model_r2'
di (`saturated_model_r2'- `restricted_model_r2')/`J'/((1-`saturated_model_r2')/ (`N'-`K')) 
gen mv_explained_p_BO = (`e(r2)')/`saturated_model_r2'
gen mv_F_p_BO = (`saturated_model_r2'- `restricted_model_r2')/`J'/((1-`saturated_model_r2')/ (`N'-`K')) 


* Markups 
reghdfe ln_mu_sbjo   ///
 age_buy_month  ln_p_inpf_sbjo ln_q_sbjo  if sample==1, ///
abs(gr_sjt gr_sb ) vce (cluster b_id) 
local saturated_model_r2 = e(r2) 
local N = e(N) 
local K = 3391+2332+3
capture drop include
gen byte include = e(sample)
reghdfe ln_mu_sbjo    ///
 age_buy_month  ln_p_inpf_sbjo ln_q_sbjo  if include==1, ///
abs(gr_sjt    b_id ) vce (cluster b_id) 
local restricted_model_r2 = e(r2)
local J =`K'-(3391+3-792)
	di ( `restricted_model_r2')/`saturated_model_r2'
	di (`saturated_model_r2'- `restricted_model_r2')/`J'/((1-`saturated_model_r2')/ (`N'-`K')) 
gen mv_explained_mu_BO = (`e(r2)')/`saturated_model_r2'
gen mv_F_mu_BO = (`saturated_model_r2'- `restricted_model_r2')/`J'/((1-`saturated_model_r2')/ (`N'-`K')) 

 
* Prices 
reghdfe ln_p_sbjo   ///
  age_buy_month ln_p_inpf_sbjo ln_q_sbjo ln_q_sb_all sh_s_b age_buysel_month   if sample==1, ///
abs(gr_sjt gr_sb ) vce (cluster b_id) 
local saturated_model_r2 = e(r2) 
local N = e(N) 
local K = 3129+1913+5
capture drop include
gen byte include = e(sample)
reghdfe ln_p_sbjo    ///
  age_buy_month ln_p_inpf_sbjo ln_q_sbjo ln_q_sb_all sh_s_b age_buysel_month  if include==1, ///
abs(gr_sjt  cohort_sb  b_id ) vce (cluster b_id) 
local restricted_model_r2 = e(r2)
local J =`K'-(3176+8-679+7)
	di ( `restricted_model_r2')/`saturated_model_r2'
	di (`saturated_model_r2'- `restricted_model_r2')/`J'/((1-`saturated_model_r2')/ (`N'-`K')) 
gen mv_explained_p_BRO = (`e(r2)')/`saturated_model_r2'
gen mv_F_p_BRO = (`saturated_model_r2'- `restricted_model_r2')/`J'/((1-`saturated_model_r2')/ (`N'-`K')) 

* Markups 
reghdfe ln_mu_sbjo   ///
  age_buy_month ln_p_inpf_sbjo ln_q_sbjo ln_q_sb_all sh_s_b age_buysel_month  if sample==1, ///
abs(gr_sjt gr_sb ) vce (cluster b_id) 
local saturated_model_r2 = e(r2) 
local N = e(N) 
local K = 3129+1913+5
capture drop include
gen byte include = e(sample)
reghdfe ln_mu_sbjo    ///
  age_buy_month ln_p_inpf_sbjo ln_q_sbjo ln_q_sb_all sh_s_b age_buysel_month  if include==1, ///
abs(gr_sjt  cohort_sb  b_id ) vce (cluster b_id)
local restricted_model_r2 = e(r2) 
local J =`K'-(3176+8-679+7)
	di ( `restricted_model_r2')/`saturated_model_r2'
	di (`saturated_model_r2'- `restricted_model_r2')/`J'/((1-`saturated_model_r2')/ (`N'-`K')) 
gen mv_explained_mu_BRO = (`e(r2)')/`saturated_model_r2'
gen mv_F_mu_BRO = (`saturated_model_r2'- `restricted_model_r2')/`J'/((1-`saturated_model_r2')/ (`N'-`K')) 


eststo O_TC4: estpost tabstat mv_explained_* mv_F_*, statistics(mean) columns(statistics)	
esttab O_TC4 using "${tables}\TableC4.tex", cells("mean(fmt(a2))")  nomtitles label nonumbers noobs unstack replace posthead(" ") nodep collabels(none) prehead(" ") postfoot(" ")